// import 'babel-polyfill';
// import Es6Promise from 'es6-promise'
// require('es6-promise').polyfill()
// Es6Promise.polyfill()
import Vue from 'vue';
import store from './store';
import router from './router';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
import '@/assets/scss/incomming.scss';
import '@/assets/scss/global.scss';
import './assets/icons';
import { selectDictLabel } from '@/utils/microsys';
import { msgSuccess, msgError } from '@/utils/message';

//引入中英文切换插件vue-i18n
import VueI18n from 'vue-i18n'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'

Vue.config.productionTip = false;
Vue.prototype.dictLabel = selectDictLabel;
Vue.prototype.msgSuccess = msgSuccess;
Vue.prototype.msgError = msgError;
Vue.use(VueI18n) // 挂载


const i18n = new VueI18n({
  // locale: 'zh-CN',    // 语言标识
  locale: localStorage.getItem('language') ? localStorage.getItem('language') : 'zh-CN',
  messages: {
    'zh-CN': {
      // 通过require引入中文语言包
      ...require('./lang/zh'),
      ...zhLocale
    },
    'en-US': {
      // 通过require引入英文语言包
      ...require('./lang/en'),
      ...enLocale
    }
  }
})

Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
});

new Vue({
  router,
  store,
  render: h => h(App),
  i18n,
}).$mount('#app');
